package org.emongo.utils;


/**
 * mongo 查询操作符常量
 * @author hhm
 *
 */
public interface QueryOperator {
	/**
	 * 等于
	 */
	public String EQ="$eq";
	/**
	 * 大于
	 * usage:
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.GT,10));
	 */
	String GT = "$gt";
	
	/**
	 * 大于等于
	 * usage:
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.GTE,10));
	 */
	String GTE = "$gte";
	
	/**
	 * 小于
	 * usage:
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.LT,10));
	 */
	String LT = "$lt";
	
	/**
	 * 小于等于
	 * usage:
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.LTE,10));
	 */
	String LTE = "$lte";
	
	/**
	 * 不等于
	 * usage:
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.NE,10));
	 */
	String NE = "$ne";
	
	/**
	 * 包含
	 * usage:
	 * BasicDBList vals = new BasicDBList();
	 * vals.add(10);
	 * vals.add(20);
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.IN,vals));
	 */
	String IN = "$in";
	
	/**
	 * 不包含
	 * usage:
	 * BasicDBList vals = new BasicDBList();
	 * vals.add(10);
	 * vals.add(20);
	 * DBObject cond = new BasicDBObject("filed",new BasicDBObject(QueryOperator.NIN,vals));
	 */
	String NIN = "$nin";
	
	/**
	 * 并
	 * usage:
	 * BasicDBList condList = new BasicDBList();
	 * condList.add(new BasicDBObject("hs", new BasicDBObject("$gt", 0)));
	 * condList.add(new BasicDBObject("hs", new BasicDBObject("$lte", 30)));
	 * DBObject cond = new BasicDBObject(QueryOperator.AND,condList);
	 */
	String AND = "$and";
	
	/**
	 * 或
	 * usage:
	 * BasicDBList condList = new BasicDBList();
	 * condList.add(new BasicDBObject("hs", new BasicDBObject("$gt", 30)));
	 * condList.add(new BasicDBObject("hs", new BasicDBObject("$lte", 0)));
	 * DBObject cond = new BasicDBObject(QueryOperator.OR,condList);
	 */
	String OR = "$or";
	
	/**
	 * where条件
	 * usage:
	 * String func = "function(){return this.age>22 && this.age<=26}";
	 * DBObject cond = new BasicDBObject(QueryOperator.WHERE,func);
	 */
	String WHERE = "$where";

}
